Euclidian Distance


Let us assume that you want to compute the distance between two points: A,BA, B. To do so, you can use the euclidean distance defined as

d(B,A)=((B1A1)2+(B2A2)2) d(B,A) =\sqrt{((B_1 - A_1)^2+(B_2 - A_2)^2)}

You can generalize finding the distance between the two points (A,B)(A,B) to the distance between an nn dimensional vector as follows:

d(v,w)=i=1n(viwi)2d(\vec{v}, \vec{w}) = \sqrt{ \sum_{i=1}^{n} (v_i - w_i)^2}

Here is an example where I calculate the distance between 2 vectors (n=3n = 3).

 Complete